#include<stdio.h>
#include<stdlib.h>
char *f(){
	//char* X = malloc(500);      //ok
	char X[512];               //not ok
	sprintf(X,"hello world");
	return X+6;
}

char* foo(char *p){
	char *q = (char*)malloc(sizeof(p) + 1);
	strcpy(q,p);
	return q;
}

main(){
	char *p = "i am p";
	//printf("%s",f());
	printf("%s",foo(p));
	return 0;
}
